package zelix.hack.hacks;

import zelix.hack.Hack;
import zelix.hack.HackCategory;
import zelix.value.NumberValue;
import net.minecraft.network.play.client.CPacketEntityAction;
import net.minecraft.network.play.client.CPacketEntityAction.Action;
import net.minecraftforge.event.entity.player.AttackEntityEvent;
import zelix.utils.Wrapper;

public class SuperKick extends Hack {
	NumberValue hurtTimeValue;

	public SuperKick() {
		super("SuperKick", HackCategory.COMBAT);

		hurtTimeValue = new NumberValue("HurtTime", 10D, 0D, 10D);

		this.addValue(hurtTimeValue);
	}

	@Override
	public void onAttackEntity(AttackEntityEvent event) {
		if (event.getTarget().hurtResistantTime > hurtTimeValue.getValue().intValue()) {
			
	
			if (Wrapper.INSTANCE.player().isSprinting()) {
				Wrapper.INSTANCE.sendPacket(new CPacketEntityAction(Wrapper.INSTANCE.player(), Action.STOP_SPRINTING));

				Wrapper.INSTANCE.sendPacket(new CPacketEntityAction(Wrapper.INSTANCE.player(), Action.START_SPRINTING));
				Wrapper.INSTANCE.sendPacket(new CPacketEntityAction(Wrapper.INSTANCE.player(), Action.STOP_SPRINTING));
				Wrapper.INSTANCE.sendPacket(new CPacketEntityAction(Wrapper.INSTANCE.player(), Action.START_SPRINTING));

				Wrapper.INSTANCE.player().setSprinting(true);
				

			}

		}
		super.onAttackEntity(event);
	}

}
